package com.jack006.api.controller.article;

import com.jack006.api.config.MyServiceList;
import com.jack006.grace.result.GraceJSONResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;

/**
 * @Classname ArticlePortalControllerApi
 * @Description 门户文章业务
 * @Date 2021-07-05 20:49
 * @Created by jack
 */
@Api(value = "门户文章业务的 controller",tags = "门户文章业务的 controller")
//@RequestMapping(value = "portal/article")
@FeignClient(value = MyServiceList.SERVICE_ARTICLE, qualifier="articlePortalControllerApi")
public interface ArticlePortalControllerApi {



    @ApiOperation(value = "门户端查询es文章列表",notes = "门户端查询es文章列表",httpMethod = "GET")
    @GetMapping("portal/article/es/list")
    GraceJSONResult eslist(@RequestParam(name = "keyword",required = false) String keyword,
                         @RequestParam(name = "category",required = false) Integer category,
                         @ApiParam(name = "page", value = "查询下一页的第几页", required = false)
                         @RequestParam("page") Integer page,
                         @ApiParam(name = "pageSize", value = "分页的每一页显示的条数", required = false)
                         @RequestParam("pageSize") Integer pageSize);

    @ApiOperation(value = "门户端查询文章列表",notes = "门户端查询文章列表",httpMethod = "GET")
    @GetMapping("portal/article/list")
    GraceJSONResult list(@RequestParam(name = "keyword",required = false) String keyword,
                         @RequestParam(name = "category",required = false) Integer category,
                         @ApiParam(name = "page", value = "查询下一页的第几页", required = false)
                         @RequestParam("page") Integer page,
                         @ApiParam(name = "pageSize", value = "分页的每一页显示的条数", required = false)
                         @RequestParam("pageSize") Integer pageSize);

    @GetMapping("portal/article/hotList")
    @ApiOperation(value = "首页查询热闻列表", notes = "首页查询热闻列表", httpMethod = "GET")
    GraceJSONResult hotList();



    @ApiOperation(value = "查询作家文章",notes = "查询作家文章",httpMethod = "GET")
    @GetMapping("portal/article/queryArticleListOfWriter")
    GraceJSONResult queryArticleListOfWriter(@RequestParam("writerId") String writerId,
                                 @ApiParam(name = "page", value = "查询下一页的第几页", required = false)
                                 @RequestParam("page") Integer page,
                                 @ApiParam(name = "pageSize", value = "分页的每一页显示的条数", required = false)
                                 @RequestParam("pageSize") Integer pageSize);

    @ApiOperation(value = "查询用户近期佳文",notes = "查询用户近期佳文",httpMethod = "GET")
    @GetMapping("portal/articlequeryGoodArticleListOfWriter")
    GraceJSONResult queryGoodArticleListOfWriter(@RequestParam("writerId") String writerId);


    @ApiOperation(value = "文章详情查询",notes = "文章详情查询",httpMethod = "GET")
    @GetMapping("portal/article/detail")
    GraceJSONResult detail(@RequestParam("articleId") String  articleId);

    @ApiOperation(value = "获得文章阅读数",notes = "获得文章阅读数",httpMethod = "GET")
    @GetMapping("portal/article/readCounts")
    Integer readCounts(@RequestParam("articleId") String  articleId);



    @ApiOperation(value = "阅读文章，文章阅读数累加",notes = "阅读文章，文章阅读数累加",httpMethod = "POST")
    @PostMapping("/readArticle")
    GraceJSONResult readArticle(@RequestParam("articleId") String  articleId, HttpServletRequest request);

}


